package org.urchr.beorganized.api.impl.agenda;

import org.urchr.beorganized.api.base.PrivateBaseAPIServlet;
import org.urchr.beorganized.dao.NotesDAO;
import org.urchr.beorganized.dao.XMLDocumentBuilder;
import org.urchr.beorganized.dao.errors.GeneralException;

public class ClearPastEvents extends PrivateBaseAPIServlet {

	@Override
	protected void doProcessPrivate() throws GeneralException {
		int noteID = NotesDAO.safeInt(getParameter("noteid"), -1);
		XMLDocumentBuilder doc = new XMLDocumentBuilder();
		doc.getRootElement("result").setAttribute("count", 
				""+NotesDAO.clearPastEvents(noteID, userID));
		sendNode(doc.getRootElement());
	}

}
